package com.oreilly.ez.fileserver.service.impl;


import com.oreilly.ez.fileserver.entity.FileInfo;
import com.oreilly.ez.fileserver.repo.FileInfoRepo;
import com.oreilly.ez.fileserver.service.IFileInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class FileInfoService implements IFileInfoService {

    @Autowired
    private FileInfoRepo repo;

//    @Autowired
//    private FileInfoMapper fileInfoMapper;
//
//    public boolean insert(FileInfo fileInfo){
//        return fileInfoMapper.insert(fileInfo) > 0;
//    }

    @Override
    public void add(FileInfo fileInfo) {

        repo.save(fileInfo);
    }

    @Override
    public void deleteByIds(String[] ids) {

        for (String id : ids) {
            repo.deleteById(id);
        }
    }

    @Override
    public void update(FileInfo fileInfo) {

    }


    @Override
    public Page<FileInfo> find(FileInfo fileInfo, Pageable pageable) {
        return repo.findAll(pageable);
    }

    @Override
    public FileInfo findById(String id) {
        return null;
    }

//    public boolean del(String sid){
//        return fileInfoMapper.del(sid) > 0;
//    }
//
//    public FileInfo get(String sid){
//        return fileInfoMapper.get(sid);
//    }
//
//    public List<FileInfo> all(){
//        return fileInfoMapper.all();
//    }

}
